﻿namespace Leetcode.N0122;
public class Solution
{
    public int MaxProfit(int[] prices)
    {
        var profit = 0;
        for (int i = 0; i < prices.Length - 1; i++)
        {
            if (prices[i] < prices[i + 1])
            {
                profit += prices[i + 1] - prices[i];
            }
        }
        return profit;
    }
}
